package org.emet.dao;

import org.emet.entity.biz.ChargeItem;
import org.emet.jee.core.dao.arch.ArchDataSourceBaseDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

@Repository
public class ChargetItemDao extends ArchDataSourceBaseDao<ChargeItem, Long> {

	@Autowired
	private ChargeRecordDao chargeRecordDao;

	public void delete_batch(Long[] array) {
		String hql = "delete from ChargeItem where ";

		if (array.length > 0) {
			for (int i = 0; i < array.length; i++) {
				hql += " id = ? ";
				if (i != array.length - 1) {
					hql += " or ";
				}
			}
			int batchExecuteCount = batchExecute(hql, array);
			if (batchExecuteCount != array.length)
				throw new RuntimeException("Failed=" + batchExecuteCount);
		}
	}

}
